package com.lagou.serializer;

import java.io.IOException;

/**
 * @author Kirito
 * @description:
 * @date 2020/05/22
 */
public interface Serializer {
    /**
     * java对象转换为二进制
     *
     * @param object Object
     * @return byte[]
     * @throws IOException e
     */
    byte[] serialize(Object object) throws IOException;


    /**
     * 二进制转换成java对象
     *
     * @param clazz Class
     * @param bytes byte[]
     * @return T
     * @throws IOException e
     */
    <T> T deSerialize(Class<T> clazz, byte[] bytes) throws IOException;
}
